package com.atguigu;

import com.streamxhub.streamx.flink.core.StreamEnvConfig;
import com.streamxhub.streamx.flink.core.java.source.KafkaSource;
import com.streamxhub.streamx.flink.core.scala.StreamingContext;
import com.streamxhub.streamx.flink.core.scala.source.KafkaRecord;
import org.apache.flink.api.common.functions.MapFunction;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2022/2/22 15:27
 */
public class StreamxDemo {
    public static void main(String[] args) {
        
        StreamEnvConfig conf = new StreamEnvConfig(args, null);
        StreamingContext ctx = new StreamingContext(conf);
        new KafkaSource<String>(ctx)
            .getDataStream()
            .map(new MapFunction<KafkaRecord<String>, String>() {
                @Override
                public String map(KafkaRecord<String> value) throws Exception {
                    return value.value();
                }
                
            })
            .print();
        
        ctx.start();
    }
}
